#include <iostream>
#include<vector>
using namespace std;

const int N = 2e6 + 10;
int n, m, x;
vector<int> arr(N);

int main()
{
    cin >> n >> m;
	for(int i =1; i <= n; i++)
	{
	    cin >> arr[i];	
	}
	while(m--)
	{
	    cin >> x;
		cout << arr[x] << endl;	
	}	
	return 0;
}
